﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Urb.Weather.Core.MeasureUnit;

namespace Urb.Weather.Core.Manager
{
    public class AverageConditions<Cond, U>
        where Cond : Conditions<U>
    {
        public AverageConditions()
        {
            this.Components = new List<Cond>();
        }

        public decimal AverageValue { get; set; }
        public U Unit { get; set; }

        public List<Cond> Components { get; protected set; }
    }

    public class AverageTemperatureConditions : AverageConditions<TemperatureConditions, TemperatureUnit>
    {
        public AverageTemperatureConditions Clone()
        {
            var clone = MemberwiseClone() as AverageTemperatureConditions;
            clone.Components = new List<TemperatureConditions>();
            clone.Components.AddRange(Components.Select(c => c.Clone()));
            return clone;
        }
    }

    public class AveragePressureConditions : AverageConditions<PressureConditions, PressureUnit>
    {
        public AveragePressureConditions Clone()
        {
            var clone = MemberwiseClone() as AveragePressureConditions;
            clone.Components = new List<PressureConditions>();
            clone.Components.AddRange(Components.Select(c => c.Clone()));
            return clone;
        }
    }
}
